package com.alog.yzd.bookmall.web.servlet.catagory;

import com.alog.yzd.bookmall.domain.catagory.Catagory;
import com.alog.yzd.bookmall.service.catagory.CatagoryService;
import com.alog.yzd.commons.servlet.BaseServlet;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

public class CatagoryServlet extends BaseServlet {
    private CatagoryService catagoryService = new CatagoryService();

    /**
     * 所有分类
     * @param req
     * @param resp
     * @return
     * @throws ServletException
     * @throws IOException
     */
    public String findAll(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        List<Catagory> catagories = catagoryService.findAll();
        req.setAttribute("parents", catagories);
        return "f:/jsps/left.jsp";
    }
}
